 /**
 * v-hasPermi 操作权限处理
 * Copyright (c) 2021
 */
  export const hasPermi = {
    install (Vue) {
        Vue.directive('hasPermi', {
            bind (el, binding, vnode) {
                //包含参数即显示按钮
                const permissions = localStorage.getItem("permissionsList")
                const value = binding.value
                let flag = false
                if(permissions == ["*:*:*"]){
                    flag = true
                }else{
                  for (const v of value) {
                      if (permissions && permissions.includes(v)) {
                          flag = true
                      }
                  }
                }
                if (!flag) {
                    if (!el.parentNode) {
                        el.style.display = 'none'
                    } else {
                        el.parentNode.removeChild(el)
                    }
                }
            }
        })
    }
}